home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.1B1 / AIncludes / DatabaseAccess.a < prev    next >
Encoding:
Text File  |  1995-04-18  |  9.8 KB  |  420 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        DatabaseAccess.a
  3. ;
  4. ;    Contains:    Database Access Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.1ß1 in “MPW Prerelease” on ETO #17
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__DATABASEACCESS__') = 'UNDEFINED' THEN
  21. __DATABASEACCESS__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__RESOURCES__') = 'UNDEFINED' THEN
  25.     include 'Resources.a'
  26.     ENDIF
  27. ;        include 'Types.a'                                            ;
  28. ;            include 'ConditionalMacros.a'                            ;
  29. ;        include 'MixedMode.a'                                        ;
  30. ;        include 'Files.a'                                            ;
  31. ;            include 'OSUtils.a'                                    ;
  32. ;                include 'Memory.a'                                    ;
  33.  
  34. typeNone                        EQU        'none'
  35. typeDate                        EQU        'date'
  36. typeTime                        EQU        'time'
  37. typeTimeStamp                    EQU        'tims'
  38. typeDecimal                        EQU        'deci'
  39. typeMoney                        EQU        'mone'
  40. typeVChar                        EQU        'vcha'
  41. typeVBin                        EQU        'vbin'
  42. typeLChar                        EQU        'lcha'
  43. typeLBin                        EQU        'lbin'
  44. typeDiscard                        EQU        'disc'
  45. ; "dummy" types for DBResultsToText 
  46. typeUnknown                        EQU        'unkn'
  47. typeColBreak                    EQU        'colb'
  48. typeRowBreak                    EQU        'rowb'
  49. ; pass this in to DBGetItem for any data type 
  50. typeAnyType                        EQU        0
  51.  
  52. ; infinite timeout value for DBGetItem 
  53. ; messages for status functions for DBStartQuery 
  54. kDBUpdateWind                    EQU        0
  55. kDBAboutToInit                    EQU        1
  56. kDBInitComplete                    EQU        2
  57. kDBSendComplete                    EQU        3
  58. kDBExecComplete                    EQU        4
  59. kDBStartQueryComplete            EQU        5
  60.  
  61. ; messages for status functions for DBGetQueryResults 
  62. kDBGetItemComplete                EQU        6
  63. kDBGetQueryResultsComplete        EQU        7
  64. kDBWaitForever                    EQU        -1
  65. ;  flags for DBGetItem  
  66. kDBLastColFlag                    EQU        $0001
  67. kDBNullFlag                        EQU        $0004
  68.  
  69. ; typedef OSType             DBType
  70. ; typedef struct DBAsyncParamBlockRec  DBAsyncParamBlockRec, *DBAsyncParmBlkPtr
  71. DBAsyncParamBlockRec     RECORD    0
  72. completionProc             ds.l   1        ; offset: $0 (0)        ; pointer to completion routine 
  73. result                     ds.w   1        ; offset: $4 (4)        ; result of call 
  74. userRef                     ds.l   1        ; offset: $6 (6)        ; for application's use 
  75. ddevRef                     ds.l   1        ; offset: $A (10)        ; for ddev's use 
  76. reserved                 ds.l   1        ; offset: $E (14)        ; for internal use 
  77. sizeof                     EQU *            ; size:   $12 (18)
  78.                         ENDR
  79.  
  80. ResListElem             RECORD    0
  81. theType                     ds.l   1        ; offset: $0 (0)        ; resource type 
  82. id                         ds.w   1        ; offset: $4 (4)        ; resource id 
  83. sizeof                     EQU *            ; size:   $6 (6)
  84.                         ENDR
  85.  
  86. ; typedef struct ResListElem  ResListElem
  87. ; typedef ResListElem         *ResListPtr, **ResListHandle
  88. ; structure for query list in QueryRecord 
  89. ; typedef Handle             QueryArray[256]
  90. QueryRecord             RECORD    0
  91. version                     ds.w   1        ; offset: $0 (0)        ; version 
  92. id                         ds.w   1        ; offset: $2 (2)        ; id of 'qrsc' this came from 
  93. queryProc                 ds.l   1        ; offset: $4 (4)        ; handle to query def proc 
  94. ddevName                 ds.l   16        ; offset: $8 (8)        ; ddev name 
  95. host                     ds.l   64        ; offset: $48 (72)        ; host name 
  96. user                     ds.l   64        ; offset: $148 (328)    ; user name 
  97. password                 ds.l   64        ; offset: $248 (584)    ; password 
  98. connStr                     ds.l   64        ; offset: $348 (840)    ; connection string 
  99. currQuery                 ds.w   1        ; offset: $448 (1096)    ; index of current query 
  100. numQueries                 ds.w   1        ; offset: $44A (1098)    ; number of queries in list 
  101. queryList                 ds.l   1        ; offset: $44C (1100)    ; handle to array of handles to text 
  102. numRes                     ds.w   1        ; offset: $450 (1104)    ; number of resources in list 
  103. resList                     ds.l   1        ; offset: $452 (1106)    ; handle to array of resource list elements 
  104. dataHandle                 ds.l   1        ; offset: $456 (1110)    ; for use by query def proc 
  105. refCon                     ds.l   1        ; offset: $45A (1114)    ; for use by application 
  106. sizeof                     EQU *            ; size:   $45E (1118)
  107.                         ENDR
  108.  
  109. ; typedef struct QueryRecord  QueryRecord
  110. ; typedef QueryRecord         *QueryPtr, **QueryHandle
  111. ; structure of column types array in ResultsRecord 
  112. ; typedef DBType             ColTypesArray[256]
  113. DBColInfoRecord         RECORD    0
  114. len                         ds.w   1        ; offset: $0 (0)
  115. places                     ds.w   1        ; offset: $2 (2)
  116. flags                     ds.w   1        ; offset: $4 (4)
  117. sizeof                     EQU *            ; size:   $6 (6)
  118.                         ENDR
  119.  
  120. ; typedef struct DBColInfoRecord  DBColInfoRecord
  121. ; typedef DBColInfoRecord     ColInfoArray[256]
  122. ResultsRecord             RECORD    0
  123. numRows                     ds.w   1        ; offset: $0 (0)        ; number of rows in result 
  124. numCols                     ds.w   1        ; offset: $2 (2)        ; number of columns per row 
  125. colTypes                 ds.l   1        ; offset: $4 (4)        ; data type array 
  126. colData                     ds.l   1        ; offset: $8 (8)        ; actual results 
  127. colInfo                     ds.l   1        ; offset: $C (12)        ; DBColInfoRecord array 
  128. sizeof                     EQU *            ; size:   $10 (16)
  129.                         ENDR
  130.  
  131. ; typedef struct ResultsRecord  ResultsRecord
  132. ;
  133. ; pascal OSErr InitDBPack(void)
  134. ;
  135.     IF ¬ GENERATINGCFM THEN
  136.         Macro
  137.         _InitDBPack
  138.             move.w    #$0004,-(sp)
  139.             move.w    #$0100,d0
  140.             dc.w     $A82F
  141.         EndM
  142.     ELSE
  143.         IMPORT_CFM_FUNCTION    InitDBPack
  144.     ENDIF
  145.  
  146. ;
  147. ; pascal OSErr DBInit(long *sessID, ConstStr63Param ddevName, ConstStr255Param host, ConstStr255Param user, ConstStr255Param passwd, ConstStr255Param connStr, DBAsyncParmBlkPtr asyncPB)
  148. ;
  149.     IF ¬ GENERATINGCFM THEN
  150.         Macro
  151.         _DBInit
  152.             move.w    #$0E02,d0
  153.             dc.w     $A82F
  154.         EndM
  155.     ELSE
  156.         IMPORT_CFM_FUNCTION    DBInit
  157.     ENDIF
  158.  
  159. ;
  160. ; pascal OSErr DBEnd(long sessID, DBAsyncParmBlkPtr asyncPB)
  161. ;
  162.     IF ¬ GENERATINGCFM THEN
  163.         Macro
  164.         _DBEnd
  165.             move.w    #$0403,d0
  166.             dc.w     $A82F
  167.         EndM
  168.     ELSE
  169.         IMPORT_CFM_FUNCTION    DBEnd
  170.     ENDIF
  171.  
  172. ;
  173. ; pascal OSErr DBGetConnInfo(long sessID, short sessNum, long *returnedID, long *version, Str63 ddevName, Str255 host, Str255 user, Str255 network, Str255 connStr, long *start, OSErr *state, DBAsyncParmBlkPtr asyncPB)
  174. ;
  175.     IF ¬ GENERATINGCFM THEN
  176.         Macro
  177.         _DBGetConnInfo
  178.             move.w    #$1704,d0
  179.             dc.w     $A82F
  180.         EndM
  181.     ELSE
  182.         IMPORT_CFM_FUNCTION    DBGetConnInfo
  183.     ENDIF
  184.  
  185. ;
  186. ; pascal OSErr DBGetSessionNum(long sessID, short *sessNum, DBAsyncParmBlkPtr asyncPB)
  187. ;
  188.     IF ¬ GENERATINGCFM THEN
  189.         Macro
  190.         _DBGetSessionNum
  191.             move.w    #$0605,d0
  192.             dc.w     $A82F
  193.         EndM
  194.     ELSE
  195.         IMPORT_CFM_FUNCTION    DBGetSessionNum
  196.     ENDIF
  197.  
  198. ;
  199. ; pascal OSErr DBSend(long sessID, Ptr text, short len, DBAsyncParmBlkPtr asyncPB)
  200. ;
  201.     IF ¬ GENERATINGCFM THEN
  202.         Macro
  203.         _DBSend
  204.             move.w    #$0706,d0
  205.             dc.w     $A82F
  206.         EndM
  207.     ELSE
  208.         IMPORT_CFM_FUNCTION    DBSend
  209.     ENDIF
  210.  
  211. ;
  212. ; pascal OSErr DBSendItem(long sessID, DBType dataType, short len, short places, short flags, void *buffer, DBAsyncParmBlkPtr asyncPB)
  213. ;
  214.     IF ¬ GENERATINGCFM THEN
  215.         Macro
  216.         _DBSendItem
  217.             move.w    #$0B07,d0
  218.             dc.w     $A82F
  219.         EndM
  220.     ELSE
  221.         IMPORT_CFM_FUNCTION    DBSendItem
  222.     ENDIF
  223.  
  224. ;
  225. ; pascal OSErr DBExec(long sessID, DBAsyncParmBlkPtr asyncPB)
  226. ;
  227.     IF ¬ GENERATINGCFM THEN
  228.         Macro
  229.         _DBExec
  230.             move.w    #$0408,d0
  231.             dc.w     $A82F
  232.         EndM
  233.     ELSE
  234.         IMPORT_CFM_FUNCTION    DBExec
  235.     ENDIF
  236.  
  237. ;
  238. ; pascal OSErr DBState(long sessID, DBAsyncParmBlkPtr asyncPB)
  239. ;
  240.     IF ¬ GENERATINGCFM THEN
  241.         Macro
  242.         _DBState
  243.             move.w    #$0409,d0
  244.             dc.w     $A82F
  245.         EndM
  246.     ELSE
  247.         IMPORT_CFM_FUNCTION    DBState
  248.     ENDIF
  249.  
  250. ;
  251. ; pascal OSErr DBGetErr(long sessID, long *err1, long *err2, Str255 item1, Str255 item2, Str255 errorMsg, DBAsyncParmBlkPtr asyncPB)
  252. ;
  253.     IF ¬ GENERATINGCFM THEN
  254.         Macro
  255.         _DBGetErr
  256.             move.w    #$0E0A,d0
  257.             dc.w     $A82F
  258.         EndM
  259.     ELSE
  260.         IMPORT_CFM_FUNCTION    DBGetErr
  261.     ENDIF
  262.  
  263. ;
  264. ; pascal OSErr DBBreak(long sessID, Boolean abort, DBAsyncParmBlkPtr asyncPB)
  265. ;
  266.     IF ¬ GENERATINGCFM THEN
  267.         Macro
  268.         _DBBreak
  269.             move.w    #$050B,d0
  270.             dc.w     $A82F
  271.         EndM
  272.     ELSE
  273.         IMPORT_CFM_FUNCTION    DBBreak
  274.     ENDIF
  275.  
  276. ;
  277. ; pascal OSErr DBGetItem(long sessID, long timeout, DBType *dataType, short *len, short *places, short *flags, void *buffer, DBAsyncParmBlkPtr asyncPB)
  278. ;
  279.     IF ¬ GENERATINGCFM THEN
  280.         Macro
  281.         _DBGetItem
  282.             move.w    #$100C,d0
  283.             dc.w     $A82F
  284.         EndM
  285.     ELSE
  286.         IMPORT_CFM_FUNCTION    DBGetItem
  287.     ENDIF
  288.  
  289. ;
  290. ; pascal OSErr DBUnGetItem(long sessID, DBAsyncParmBlkPtr asyncPB)
  291. ;
  292.     IF ¬ GENERATINGCFM THEN
  293.         Macro
  294.         _DBUnGetItem
  295.             move.w    #$040D,d0
  296.             dc.w     $A82F
  297.         EndM
  298.     ELSE
  299.         IMPORT_CFM_FUNCTION    DBUnGetItem
  300.     ENDIF
  301.  
  302. ;
  303. ; pascal OSErr DBKill(DBAsyncParmBlkPtr asyncPB)
  304. ;
  305.     IF ¬ GENERATINGCFM THEN
  306.         Macro
  307.         _DBKill
  308.             move.w    #$020E,d0
  309.             dc.w     $A82F
  310.         EndM
  311.     ELSE
  312.         IMPORT_CFM_FUNCTION    DBKill
  313.     ENDIF
  314.  
  315. ;
  316. ; pascal OSErr DBGetNewQuery(short queryID, QueryHandle *query)
  317. ;
  318.     IF ¬ GENERATINGCFM THEN
  319.         Macro
  320.         _DBGetNewQuery
  321.             move.w    #$030F,d0
  322.             dc.w     $A82F
  323.         EndM
  324.     ELSE
  325.         IMPORT_CFM_FUNCTION    DBGetNewQuery
  326.     ENDIF
  327.  
  328. ;
  329. ; pascal OSErr DBDisposeQuery(QueryHandle query)
  330. ;
  331.     IF ¬ GENERATINGCFM THEN
  332.         Macro
  333.         _DBDisposeQuery
  334.             move.w    #$0210,d0
  335.             dc.w     $A82F
  336.         EndM
  337.     ELSE
  338.         IMPORT_CFM_FUNCTION    DBDisposeQuery
  339.     ENDIF
  340.  
  341. ;
  342. ; pascal OSErr DBStartQuery(long *sessID, QueryHandle query, DBStatusUPP statusProc, DBAsyncParmBlkPtr asyncPB)
  343. ;
  344.     IF ¬ GENERATINGCFM THEN
  345.         Macro
  346.         _DBStartQuery
  347.             move.w    #$0811,d0
  348.             dc.w     $A82F
  349.         EndM
  350.     ELSE
  351.         IMPORT_CFM_FUNCTION    DBStartQuery
  352.     ENDIF
  353.  
  354. ;
  355. ; pascal OSErr DBGetQueryResults(long sessID, ResultsRecord *results, long timeout, DBStatusUPP statusProc, DBAsyncParmBlkPtr asyncPB)
  356. ;
  357.     IF ¬ GENERATINGCFM THEN
  358.         Macro
  359.         _DBGetQueryResults
  360.             move.w    #$0A12,d0
  361.             dc.w     $A82F
  362.         EndM
  363.     ELSE
  364.         IMPORT_CFM_FUNCTION    DBGetQueryResults
  365.     ENDIF
  366.  
  367. ;
  368. ; pascal OSErr DBResultsToText(ResultsRecord *results, Handle *theText)
  369. ;
  370.     IF ¬ GENERATINGCFM THEN
  371.         Macro
  372.         _DBResultsToText
  373.             move.w    #$0413,d0
  374.             dc.w     $A82F
  375.         EndM
  376.     ELSE
  377.         IMPORT_CFM_FUNCTION    DBResultsToText
  378.     ENDIF
  379.  
  380. ;
  381. ; pascal OSErr DBInstallResultHandler(DBType dataType, DBResultHandlerUPP theHandler, Boolean isSysHandler)
  382. ;
  383.     IF ¬ GENERATINGCFM THEN
  384.         Macro
  385.         _DBInstallResultHandler
  386.             move.w    #$0514,d0
  387.             dc.w     $A82F
  388.         EndM
  389.     ELSE
  390.         IMPORT_CFM_FUNCTION    DBInstallResultHandler
  391.     ENDIF
  392.  
  393. ;
  394. ; pascal OSErr DBRemoveResultHandler(DBType dataType)
  395. ;
  396.     IF ¬ GENERATINGCFM THEN
  397.         Macro
  398.         _DBRemoveResultHandler
  399.             move.w    #$0215,d0
  400.             dc.w     $A82F
  401.         EndM
  402.     ELSE
  403.         IMPORT_CFM_FUNCTION    DBRemoveResultHandler
  404.     ENDIF
  405.  
  406. ;
  407. ; pascal OSErr DBGetResultHandler(DBType dataType, DBResultHandlerUPP *theHandler, Boolean getSysHandler)
  408. ;
  409.     IF ¬ GENERATINGCFM THEN
  410.         Macro
  411.         _DBGetResultHandler
  412.             move.w    #$0516,d0
  413.             dc.w     $A82F
  414.         EndM
  415.     ELSE
  416.         IMPORT_CFM_FUNCTION    DBGetResultHandler
  417.     ENDIF
  418.  
  419.     ENDIF ; __DATABASEACCESS__
  420.